import { GetanButtonProps } from "@/components/Button/src/types"

/**
 * 抽屉属性
 */
export interface GetanDrawerProps {
    /**
     * 标题头
     */
    title?: string
    /**
     * 标题头左侧图标
     */
    icon?: string
    /**
     * 显示位置，默认为 right
     */
    placement?: "top" | "right" | "bottom" | "left"
    /**
     * 宽度，[当前宽度，最小宽度，最大宽度]
     */
    width?: number | [number, number, number]
    /**
     * 是否可关闭
     */
    closable?: boolean
    /**
     * 是否可自主调整大小
     */
    resizable?: boolean
    /**
     * 点击外部是否关闭
     */
    maskClosable?: boolean
    /**
     * 取消按钮 @on-cancel
     */
    cancel?: false | GetanButtonProps
    /**
     * 确认按钮 @on-ok
     */
    ok?: false | GetanButtonProps
    /**
     * 按钮位置
     */
    actionPosition?: "left" | "right"
}

/**
 * @description: 弹窗对外暴露的方法
 */
export interface DrawerMethods {
    init?: (props: Partial<GetanDrawerProps>) => void
    open: (title?: string) => void
    close: () => void
}

export type RegisterFn = (DrawerInstance: DrawerMethods) => void

export type UseDrawerReturnType = { register: RegisterFn; methods: DrawerMethods }
